#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <sys/param.h>
#ifdef HPUX
#include <sys/pstat.h>
#endif
#include <errno.h>

#ifdef HPUX
double fivemin_loadavg(void)
{
static struct pst_dynamic pd2;
int x;
	x=pstat_getdynamic(&pd2,sizeof(struct pst_dynamic),(size_t)1,0);
	if(x==1) {
		return(pd2.psd_avg_5_min);
	}
	return(-1.0);
}
#endif

int main(int argc,char **argv)
{
	double x=fivemin_loadavg();
	if(x==-1.0) {
		fprintf(stderr,"Error: Unable to get load average.\n");
		exit(1);
	} else {
		printf("%0.2f\n",x);
		exit(0);
	}
}

